//package org.jeecg.modules.utils.est100;
//
//import java.io.UnsupportedEncodingException;
//import java.util.ArrayList;
//import java.util.Date;
//
//public class JavaCallCppTest {
//
//
//	public static void print_byteArray(byte[] src, int length) {
//        for (int i = 0; i < length; ++i) {
//            String hex = Integer.toHexString(src[i] & 0xFF);
//            if (hex.length() == 1) {
//                hex = '0' + hex;
//            }
//            System.out.print(hex.toUpperCase());
//        }
//    }
//
//	public static void main(String[] args) {
//
//		//身份证
//		int hReader = JavaCallCppService.INSTANCE.EU_Reader_Open("USB1");
//	   	 System.out.println("hReader="+hReader);
//
//	   	 if(hReader <= 0){//    结果大于0表示成功
//	   		 System.err.println("==打开接口失败==hReader="+hReader+"=======状态码====="+hReader);
//	   		 return;
//	   	 }
//	   	String filepath = "D:\\est\\zp.bmp";
//		byte[] pName = new byte[100];
//		byte[] pSex = new byte[100];
//		byte[] pNation = new byte[100];
//		byte[] pBirth = new byte[100];
//		byte[] pAddress = new byte[100];
//		byte[] pCertNo = new byte[100];
//		byte[] pDepartment = new byte[100];
//		byte[] pEffectDate = new byte[100];
//		byte[] pExpire = new byte[100];
//		byte[] pErrMsg = new byte[100];
//
//		int nRt = -99;
//		nRt = JavaCallCppService.INSTANCE.PEU_Reader_ReadIDCard(hReader, pErrMsg);
//		if(nRt != 0) {
//			System.err.println("读卡失败，返回值："+nRt);
//			return;
//		}
//		JavaCallCppService.INSTANCE.GetName(pName);
//		JavaCallCppService.INSTANCE.GetSex(pSex);
//		JavaCallCppService.INSTANCE.GetNation(pNation);
//		JavaCallCppService.INSTANCE.GetBirth(pBirth);
//		JavaCallCppService.INSTANCE.GetAddress(pAddress);
//		JavaCallCppService.INSTANCE.GetCertNo(pCertNo);
//		JavaCallCppService.INSTANCE.GetDepartemt(pDepartment);
//		JavaCallCppService.INSTANCE.GetEffectDate(pEffectDate);
//		JavaCallCppService.INSTANCE.GetExpireDate(pExpire);
//		JavaCallCppService.INSTANCE.GetBmpFile(filepath);
//		System.out.println("姓名："+  new String(pName));
//		System.out.println("性別："+  new String(pSex).substring(0,2));//性别这里截取一下，后面有个L
//		System.out.println("民族："+  new String(pNation));
//		System.out.println("出生日期："+  new String(pBirth));
//		System.out.println("地址："+  new String(pAddress));
//		System.out.println("身份证号："+  new String(pCertNo));
//		System.out.println("签发机关："+  new String(pDepartment));
//		System.out.println("发卡日期："+  new String(pEffectDate));
//		System.out.println("有效期限："+  new String(pExpire));
//
//


		/*******************社保卡读取部分********************/
		/*int hReader = JavaCallCppService.INSTANCE.EU_Reader_Open("USB1");
	   	 System.out.println("hReader="+hReader);

	   	 if(hReader <= 0){//    结果大于0表示成功
	   		 System.err.println("==打开接口失败==hReader="+hReader+"=======状态码====="+hReader);
	   		 return;
	   	 }

		byte[] SBKH = new byte[100];
		byte[] XM = new byte[100];
		byte[] XB = new byte[100];
		byte[] MZ = new byte[100];
		byte[] CSRQ = new byte[100];
		byte[] SHBZHM = new byte[100];
		byte[] FKRQ = new byte[100];
		byte[] KYXQ = new byte[100];
		byte[] pErrMsg = new byte[100];

		int nRt = -99;
		nRt = JavaCallCppService.INSTANCE.PEU_Reader_SICARD(hReader,
				SBKH,
				XM,
				XB,
				MZ,
				CSRQ,
				SHBZHM,
				FKRQ,
				KYXQ,
				pErrMsg);
		if(nRt != 0) {
			System.err.println("读卡失败，返回值："+nRt);
			return;
		}
		System.out.println("姓名："+  new String(XM));
		System.out.println("性別："+  new String(XB));
		System.out.println("民族："+  new String(MZ));
		System.out.println("出生日期："+  new String(CSRQ));
		System.out.println("社保卡号："+  new String(SBKH));
		System.out.println("身份证号："+  new String(SHBZHM));
		System.out.println("发卡日期："+  new String(FKRQ));
		System.out.println("卡有效期："+  new String(KYXQ));*/



		/*******************M1卡读取部分********************/
		/*byte[] anticollUid = new byte[10];
		byte tpye = 0x41;
		byte mode=0x60; //认证KeyA = 0x60， KeyB=0x61
	    byte secNr=0x01;;//此处填写实际的扇区 0~15
	    byte[] passWord = {(byte)0xff,(byte) 0xff,(byte)0xff,(byte)0xff,(byte)0xff,(byte)0xff};
	    byte[] data = new byte[50];
    	byte addr=4;//此处填写实际的块 0~63

    	int hReader = JavaCallCppService.INSTANCE.EU_Reader_Open("USB1");
    	 System.out.println(" hReader="+hReader);
    	 if(hReader <= 0){
    		 System.err.println("==打开接口失败,状态码:"+hReader);
    		 return;
    	 }
    	 int request = JavaCallCppService.INSTANCE.PEU_Reader_Request(hReader);
    	 System.out.println(" request="+request);
    	 if(request != 0){
    		 System.err.println("==请求卡片接口失败==request=="+request+"=======状态码====="+request);
    		 return;
    	 }
    	int anticoll = JavaCallCppService.INSTANCE.PEU_Reader_anticoll(hReader,anticollUid);
    	System.out.println(" anticoll="+anticoll);
    	if(anticoll != 0){//结果等于0 表示成功
    		System.out.println("==防碰撞接口失败==anticoll=="+anticoll+"=======状态码====="+anticoll);
    		return;
    	}
	    int select = JavaCallCppService.INSTANCE.PEU_Reader_Select(hReader,tpye);
	    System.out.println(" select="+select);
	    if(select!=0){//结果等于0表示成功
	    	System.out.println("==选择接口失败==request=="+select+"=======状态码====="+select);
	    	return;
	    }
	    int auPass = JavaCallCppService.INSTANCE.PEU_Reader_Authentication_Pass(hReader,mode,secNr,passWord);
	    System.out.println(" auPass="+auPass);
	    if(auPass!=0){
	    	System.out.println("==验证接口失败==auPass=="+auPass+"=======状态码====="+auPass);
	    	return;
	    }
    	int reader = JavaCallCppService.INSTANCE.PEU_Reader_Read(hReader,addr,data);

    	System.out.println(" reader="+reader);
    	if(reader!=0){
    		System.out.println("==读卡接口失败==reader=="+reader+"=======状态码====="+reader);
    		return;
    	}

		 System.out.println("ASC:" + new String(data));
		 System.out.println("HEXSTR:");
		 print_byteArray(data, 16);*/
    	/******************* end M1卡读取部分********************/

//
//
//     }
//}
